<div class="datagrid">
	<?php echo flash_message();?>

<article class="module width_full">

<?php 

if (isset($categories) ) { 
if(count($categories)>0)
{	
	
	?>
	
<header>

<h3 class="tabs_involved">Categories Managament</h3>	

<?php 
echo form_open('category/index',array("class"=>"search_form"));   
echo form_input('search',set_value('search','search'));
echo form_submit('submit',set_value('submit','search'));
echo form_fieldset_close();  
?>

</header>



<?php

	$tmpl = array (
                    'table_open'=> '<table class="tablesorter" cellspacing="0">',
              );

$this->table->set_template($tmpl); 
	
	
	foreach ($categories as $row) {
		$links = anchor('category/edit/' . $row['id'], '<img src="'.base_url().'images/icn_edit.png" alt="Edit" />');
		$links .= anchor('category/delete/' . $row['id'], '<img src="'.base_url().'images/icn_trash.png" alt="Trash" />',array('onclick'=>"return confirm('Are you sure want to delete this category?')"));
		$this -> table -> set_heading('Name', 'Clean Name', 'Actions');
		$this -> table -> add_row($row['name'], $row['name_clean'],$links);
	}

	echo $this -> table -> generate();
	
	if ($pagination_enabled)
	{
		echo '<div class="pagination_container">' . $this -> pagination -> create_links() . '</div>';
	}
?>
<div class="other_actions">
	<?php echo anchor('category/create','Add Category');?>
</div>	

<?php 
}}
 else{
 	?>
	 <p  style="padding-left: 10px">no result found.... <?php echo anchor('category/create','Create a Category');?></p> 
<?php
 }
 ?>

	</article>
</div>